const sqlPool = require('../sqlpool');
const sqlMap = require('../sqlMap');// sql 语句

module.exports = {
  login:function (req,res) {
      let sql = sqlMap.user.login;
      let params = [req.body.username, req.body.password];

      sqlPool.connect(sql,params,function(err,result){
        let data = {};
        if(result.length <= 0){
          data = {
            code:201,
            msg:'登录失败'
          };
        }else{
          data ={
            code:200,
            msg:'登录成功'
          };
        }
        res.send(data);

      })
  }
};
